package com.demo.Mapper;

import com.demo.Model.Cj;
import com.demo.Model.Login;
import com.demo.Model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from users")
    public List<User> query();

    @Delete("delete from users where id=#{id}")
    public void deleteById(int id);

    @Insert("insert into users(id, name, gender, age) values(#{id}, #{name}, #{gender}, #{age})")
    public void insert(User user);

    @Select("select * from users where id=#{id}")
    public List<User> queryById(int id);

    @Update("update users set name=#{name}, gender=#{gender}, age=#{age} where id=#{id}")
    public void updateById(User user);

    @Select("select * from login where xh=#{xh} and password=#{password}")
    public List<Login> log(int xh, String password);

    @Select("select * from cjb where xh=#{xh}")
    public List<Cj> queryCj(int xh);

    @Select("select * from users limit #{start}, #{row}")
    public List<User> queryByPage(Integer start, Integer row);
}
